<#-- 导入变量定义文件 -->
<#include "../template/include/assign.ftl">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>操作员列表页</title>
<#-- 导入静态资源文件 -->
<#include "../template/include/source.ftl">
<link href="${web_static}/admin/css/list.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	.page{
		float:right;
		padding-top: 15px;
		margin-right: 15px;
	}
</style>
</head>
<#include "../template/template_listPage.ftl">
<script type="text/javascript">
	$().ready( function() {
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
	
	});
function deletePermission(code){
	 var result = confirm("你确认要删除吗?");
	 if (result) {
		var url="${web_base}/system/permission!delete.htm?code="+code;
		//$('#listForm').attr("action","url");
		document.forms[0].action=url;
		document.forms[0].submit();
	}
}

function refresh(){
	$.post("${web_base}/system/menu!refresh.htm");
	var hf=location.href;
	if(hf.indexOf("?")>0)
			hf=hf+"&tsssssssssssssssss="+Math.random();
	else
		hf=hf+"?tsssssssssssssssss="+Math.random();
	setTimeout(function(){location.href=hf;},3000);
}
</script>
</head>
<body class="list">
	<div class="body">
		<div class="listBar">
			<h1><span class="icon">&nbsp;</span>菜单管理&nbsp;<span class="pageInfo"></span></h1>
		</div>
		<@pageList page=(page!) id="list" action="${web_base}/system/permission!list.htm" query="permissionQuery" isEmpty=true>
			<div class="operateBar">
				<input type="button" class="addButton" onclick="location.href='${web_base}/system/permission!add.htm'" value="添加1级菜单" />
				<input type="button" class="addButton" onclick="refresh()" value="刷新缓存" />
				<label>查找:</label>
				上级菜单代码:
				<input type="text" name="permissionQuery.parentCode" value="${(permissionQuery.parentCode)!}">
				菜单/权限名
				<input type="text" name="permissionQuery.name" value="${(permissionQuery.name)!}">
				菜单级别
				<select name="permissionQuery.level">
				    <option value="" >请选择</option>
					<option value="1" <#if permissionQuery.level??&&permissionQuery.level==1>selected="selected"</#if> >1</option>
					<option value="2" <#if permissionQuery.level??&&permissionQuery.level==2>selected="selected"</#if> >2</option>
					<option value="3" <#if permissionQuery.level??&&permissionQuery.level==3>selected="selected"</#if> >3</option>
				</select>
				是否为菜单
				<select name="flag">
				    <option value="">请选择</option>
					<option value="true" <#if flag??&&flag=="true">selected="selected"</#if>>是</option>
					<option value="false" <#if flag??&&flag=="false">selected="selected"</#if>>否</option>
				</select>
				<input type="submit" id="searchButton" class="searchButton" value="" />
			</div>
			<table class="listTable">
				<tr>
					<th>
						<span class="sort" name="code">权限代码</span>
					</th>
					<th>
						<span class="sort" name="name">名称</span>
					</th>
					<th>
						<span class="sort" name="isMenu">是否为菜单</span>
					</th>
					<th>
						<span class="sort" name="level">级别</span>
					</th>
					<th>
						<span class="sort" name="sort">排序</span>
					</th>
					<th>
						<span class="sort" name="url">URL</span>
					</th>
					<th>操作<th/>
				</tr>
				<#if  page??&&page.list??&&(page.list?size gt 0) >			
				<#list page.list as obj>
					<tr>
						<td>
							${(obj.code)!}
						</td>
						<td>
							<a href="${web_base}/system/permission!list.htm?permissionQuery.parentCode=${(obj.code)!}">${(obj.name)!}</a>
							&nbsp;
						</td>
						<td>
							<#if obj.isMenu==true>
								是
							<#else>
							否
							</#if>
						</td>
						<td>
							${(obj.level)!}
						</td>
						<td>
							${(obj.sort)!}
						</td>
						<td>
							${(obj.url)!}
						</td>
						<td>
						    <#if obj.level?default("0")==1>
						    	<a href="${web_base}/system/permission!add.htm?code=${(obj.code)!}&level=2" title="添加2级菜单">[添加2级菜单]</a>
						    <#elseif obj.level?default("0")==2>
						    	<a href="${web_base}/system/permission!add.htm?code=${(obj.code)!}&level=3" title="添加3级菜单">[添加3级菜单]</a>
							</#if>
							<a href="${web_base}/system/permission!edit.htm?code=${(obj.code)!}" title="编辑">[编辑]</a>
							<a href="javascript:void(0);" onclick="deletePermission('${(obj.code)!}');" title="删除">[删除]</a>
						</td>
					</tr>
				</#list>
				<#else>
				    <tr><td colspan="9">
					<div class="noRecord">
						没有找到任何记录!
					</div>	
					</td></tr>
				</#if>				
			</table>

		</@pageList>
	</div>
	
</body>
</html>